﻿module UtilityTests



open System
open Microsoft.VisualStudio.TestTools.UnitTesting
open Utility



[<TestClass>]
type public SourcesTests() = 



   [<TestMethod>]
   member public self.TilNone_IteratesAllValuesUntilNone() =
      let list = [| Some(1); Some(2); Some(3); None; Some(5) |] |> Seq.ofArray

      let actual = 
         TilNone(list)
         |> List.rev 
         |> List.head

      Assert.AreEqual(3, actual.Value)



   [<TestMethod>]
   member public self.TilFalse_IteratesAllValuesUntilFalse() =
      let list = [| true; true; true; false; true |] |> Seq.ofArray

      let actual = 
         TilFalse(list)
         |> List.rev 
         |> List.head

      Assert.AreEqual(true, actual)

      let actual = 
         TilFalse(list)
         |> List.rev 
         |> List.length

      Assert.AreEqual(3, actual )